package BehaviorModel.mediatorModel;

/**
 * 功能描述: 同事类
 * 2024/02/20
 * <p>
 * ZhangYi
 */
public abstract class Colleague {
    protected Mediator mediator;
    protected String name; // 同事的名称,很重要,中介者中的身份标识,由同事构造时传递,也可以属性注入

    public Colleague(Mediator mediator,String name) {
        this.mediator = mediator;
        this.name = name;
    }

    public abstract void sendMessage(int stateChange);

    /**
     * 功能描述: 获取中介者对象
     *
     * @return {@link Mediator }
     */
    public Mediator getMediator(){
        return this.mediator;
    }
}
